package com.google.pages;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;

public class ManageAccountPage extends OtherPage {
	
	private static final String eMailAddressTextLocator = "//div[@class='XDmCff']//span[@class='EEXEvb']";
	
	@FindBy(id = "nav-general")
	public WebElement generalMenuLink;
	
	@FindBy(id = "nav-security")
	public WebElement securityMenuLink;
	
	/*@FindBy(id = "nav-products")
	public WebElement productsMenuLink;*/
	@FindBy(xpath = "//div[@class='h19TVe']/div[3]")
	public WebElement productsMenuLink;
	
	@FindBy(id = "nav-exportdata")
	public WebElement exportMenuLink;
	
	@FindBy(xpath = eMailAddressTextLocator)
	public WebElement eMailAddressText;
	
	public ManageAccountPage (WebDriver driver) {
		super (driver);
	}

	public void open() {
		driver.get("https://accounts.google.com/ManageAccount");
	}
	
	public boolean verifyEmailAddress(String email) {
		return eMailAddressText.getText().equals(email);
	}
	
	public ProductsAccountPage productsMenuLinkClick() {
		productsMenuLink.click();
		return PageFactory.initElements(driver, ProductsAccountPage.class);
	}


}
